{% extends 'base.html' %}

{% block contents %}
        
<h2>Process multiple</h2>

<div class="process_box">
    
{% if different_owners %}
    <blockquote>
	<B>NB! The selected movies not owned by you have different owners.</B>
	<P/>
	<form method="get" action="/">
	    <input type="submit" value="Go back and select movies from you and at most one other user"/>
	</form>
    </blockquote>
{% else %}

    {% if both_types %}
       
    Both your own movies and movies owned by other users were found in the selection.
    
    <P/>
	<h3>Your movies in the selection:</h3>
	<P/>
	<ul>
	    {% for movie in your_movies %}
	    <li>{{movie.title}}</li>
	    {% endfor %}
	</ul>
    <P/>
	<h3>Other peoples movies in the selection:</h3>
	<P/>
	<ul>
	    {% for movie in other_peoples_movies %}
	    <li>{{movie.title}}</li>
	    {% endfor %}
	</ul>
    <P/>
    What do you want to do:
    <form action="/process_multiple/" method="post">
	<input type="submit" name="Swap" value="Send email and suggest to swap"/>
    </form>
    {% else %}
    
    {% if your_movies %}
	<h3>Selected movies owned by you:</h3>
	<P/>
	<ul>
	    {% for movie in your_movies %}
	    <li>{{movie.title}}</li>
	    {% endfor %}
	</ul>
    <P/>
    What do you want to do:
    <form action="/process_multiple/" method="post">
	<!--<input type="hidden" name="movie_keys" value="{% for movie in other_peoples_movies %}{{movie.key}};{% endfor %}"/>	       
	<input type="submit" name="borrow" value="Send email and ask to borrow these movies"/><br/>
	<input type="submit" name="buy" value="Send email and tell the dude you want to buy these movies"/><br/>
	<input type="submit" name="swap" value="Send email and tell the dude you want to swap these movies for some of your movies"/><br/>
	-->
    </form>
    {% endif %}
    
    {% if other_peoples_movies %}
	<h3>Selected movies owned by {{other_dude.nickname}}:</h3>
	<P/>
	<ul>
	    {% for movie in other_peoples_movies %}
	    <li>{{movie.title}}</li>
	    {% endfor %}
	</ul>
    <P/>
    What do you want to do:
    <form action="/process_multiple/" method="post">
	<input type="hidden" name="other_people" value="1"/>
	<input type="hidden" name="movie_keys" value="{% for movie in other_peoples_movies %}{{movie.key}};{% endfor %}"/>	       
	<input type="submit" name="borrow" value="Send email and ask to borrow these movies"/><br/>
	<input type="submit" name="buy" value="Send email and tell the dude you want to buy these movies"/><br/>
	<input type="submit" name="swap" value="Send email and tell the dude you want to swap these movies for some of your movies"/><br/>
    </form>
    {% endif %}
    
    {% endif %}

{% endif %}

</div>

{% endblock %}